// pages/secPage/jobDetail/jobDetail.js
import { getJobDetail } from '../../../api/queryList'
Page({
  data: {
    expand: false,
    isCollected: false,
    isIphone: false,
    jobId: '',
    jobDetail: ''
  },
  onLoad: function (options) {
    this._getDetail(options.jobId)
    let system = getApp().globalData.systemInfo
    if (system.model.indexOf('iPhone X') > -1 || system.model.indexOf('iPhone 11') > -1) {
      this.setData({
        isIphone: true
      })
    }
  },
  _getDetail(jobId) {
    // getJobDetail({ jobId: jobId }).then(res => {
    //   this.setData({
    //     jobDetail: res.data
    //   })
    // })
    this.setData({
          jobDetail: {"id":"001",
          "jobName":"java",
        "minSalary":"25",
        "maxSalary":"35",
        "companyId":{
          "companyName":"京东",
          "companySize":2,
          "financingType":2,
          "companyAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1596016306656&di=518af8f158bd57336a402bfa4b2ca436&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20170826%2F931d2255c28d44f4b8c1beeae0816df3.jpeg",
          "companyAdresses":[
            {"city":"银川",
            "area":"金凤区",
            "street":"北京路",
            "building":"万达中心B座",
            "No":"2020",
            
          }
          ]
        },
        "exactAddress":{
          "lat":38.494611,
          "lng":106.22618
        },
        "workExp":"5-10年",
        "eduLeve":"本科",
        "publisherId":{
          "avatarUrl":"https://img.yzcdn.cn/vant/cat.jpeg", 
          "nickName":"刘女士",
          "userJob":"HR"
        },
        "city":"北京 大兴区 亦庄",
        "detail":"<h6>1.岗位描述</h6>",
        "tags":["c/c++","嵌入式"]
      }
        })
  },
  showAllText() {
    this.setData({
      expand: !this.data.expand
    })
  },
  showMap() {
    wx.navigateTo({ url: `/pages/secPage/map/map?latitude=${this.data.jobDetail.exactAddress.lat}&longitude=${this.data.jobDetail.exactAddress.lng}&name=${this.data.jobDetail.companyId.companyName}` })
  },
  shareTap() {
    wx.chooseContact()
  },
  collectTap() {
    this.setData({
      isCollected: !this.data.isCollected
    })
  }
})